package ch10;

import java.util.Stack;

public class StackClass {

	public static void main(String[] args) {

		// stack栈结构，firstin，lastout
		Stack<Computer> stack = new Stack<>();
		// 压栈
		for (int i = 0; i < 10; i++) {
			stack.push(new Computer("hp" + i, 5000 + i));
		}

		// 弹栈
		Computer computer = null;
		while ((computer = stack.pop()) != null) {
			System.out.println(computer);
			if (stack.isEmpty()) {
				break;
			}
		}
		
	}

}
